/*
 * @Author: junhuizhou
 * @Date: 2020-12-30 10:59:14
 * @LastEditor: junhuizhou
 * @LastEditTime: 2020-12-30 11:00:56
 * @Description: header
 * @FilePath: \fzhtq\include\calmatrix.h
 */

#ifndef CALMATRIX_H_
#define CALMATRIX_H_

/**
 * @description: pMat0 = pMat1
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
void MatCpy(double *pMat0, double *pMat1, int row, int col);

/**
 * @description: pMat0 = pMat1 + pMat2
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
void MatAdd(double *pMat0, double *pMat1, double *pMat2, int row, int col);

/**
 * @description: pMat0 = pMat1 - pMat2
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
void MatSub(double *pMat0, double *pMat1, double *pMat2, int row, int col);

/**
 * @description: pMat0 = pMat1 * pMat2
 * @algorithm: 非数乘情况，pMat0不得跟pMat1或者pMat2为同一矩阵
 * @param {type} 
 * @return: 
 */
void MatMtp(double *pMat0, double *pMat1, int row1, int col1, double *pMat2, int row2, int col2);

/**
 * @description: pMat0 = [pMat]T
 * @algorithm: 由于有重复交叉元素利用，pMat0不得跟pMat1为同一矩阵
 * @param {type} 
 * @return: 
 */
void MatTrans(double *pMat0, double *pMat1, int row, int col);

/**
 * @description: 求逆
 * @algorithm: LU法分解法，接近奇异值时结果可能不准确
 * @param {type} 
 * @return: 
 */
void MatInv(double *pMat, int row);

/**
 * @description: |pMat|
 * @algorithm: 输入行列向量都可以
 * @param {type} 
 * @return: 
 */
double VectorNorm(double *pMat, int count);

/**
 * @description: pMat0 = pMat1 X pMat2
 * @algorithm: 输入行列向量都可以，pMat0不得跟pMat2为同一矩阵
 * @param {type} 
 * @return: 
 */
void VectorCross(double *pMat0, double *pMat1, double *pMat2);

/**
 * @description: print matrix
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
void MatPrint(double *pMat, int row, int col);

/**
 * @description: 均值为0，方差为1的高斯随机数发生
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
double RandN();

/**
 * @description: 0~1的均匀分布的随机数发生
 * @algorithm: 
 * @param {type} 
 * @return: 
 */
double Rand01();

#endif
